<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>
    .el-tabs__item.is-active{
      color: #058142;
    }.el-tabs__active-bar{
      background-color: #058142;
    }.el-tabs{
      background-color: #fff;
    }.el-input__inner{
      border: 0;
      font-size: 1rem;
      text-align: center;
    }.el-input__prefix{
      display: none;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">周计划</div>
      </div>
      <!--  -->
      <div class="x-ico-month">
        <el-date-picker v-model="cardsmonth" type="date" placeholder="选择月" @change="getmonth" format="yyyy 年 MM 月 dd 日" value-format="yyyyMMdd" :editable="notkey"></el-date-picker>
      </div>
      <!--  -->
      <div class="" style="margin-top:1rem;">

        <template>
          <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true">
            <el-tab-pane label="周清计划" name="first">
              <template>
                <el-table :data="tableData">
                  <el-table-column label="班组名称" width="" fixed>
                    <template slot-scope="scope">
                      {{scope.row.group}}
                    </template>
                  </el-table-column>
                  <el-table-column label="周清内容" width="">
                    <template slot-scope="scope">
                      <el-button type="text" size="mini" @click="editfavo(scope.row.group,scope.row.title)">查看</el-button>
                    </template>
                  </el-table-column>
                  <el-table-column label="完成结果" width="">
                    <template slot-scope="scope">
                      <div v-if="scope.row.is_ok=='0'" size="mini">未确认</div>
                      <div v-if="scope.row.is_ok=='1'" size="mini" class="x-text-g">已完成</div>
                      <div v-if="scope.row.is_ok=='2'" size="mini" class="x-text-r">未完成</div>
                    </template>
                  </el-table-column>
                  <el-table-column label="记录原因" width="">
                    <template slot-scope="scope">
                      <div v-if="scope.row.content==''&&scope.row.img==''">无</div>
                      <el-button type="text" size="mini" @click="editfavotwo(scope.row.id,scope.row.content,scope.row.img,scope.row.clearid)" v-else>查看</el-button>
                    </template>
                  </el-table-column>
                  <el-table-column label="检查人">
                    <template slot-scope="scope">
                      <div v-if="scope.row.username!=''||scope.row.username">{{scope.row.username}}</div>
                      <div v-else>无</div>
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </el-tab-pane>
            <el-tab-pane label="设备清洁维养计划" name="second">
              <template>
                <div class="x-pro-list" style="margin:1rem 0;" v-for="(item,index) in tableDatatwo">
                  <div class="x-inc-num">班组{{index+1}}</div>
                  <template>
                    <el-table :data="item.list">
                      <el-table-column label="设备名称" width="" fixed>
                        <template slot-scope="scope">
                          {{scope.row.title}}
                        </template>
                      </el-table-column>
                      <el-table-column label="维养周期" width="">
                        <template slot-scope="scope">
                          <div class="" v-if="scope.row.type=='1'">周</div>
                          <div class="" v-if="scope.row.type=='2'">月</div>
                          <div class="" v-if="scope.row.type=='3'">年</div>
                        </template>
                      </el-table-column>
                      <el-table-column label="维养项目" width="">
                        <template slot-scope="scope">
                          <el-button type="text" size="mini" @click="editfavo(scope.row.title,scope.row.item)">查看</el-button>
                        </template>
                      </el-table-column>
                      <el-table-column label="完成结果" width="">
                        <template slot-scope="scope">
                          <div v-if="scope.row.is_ok=='0'" size="mini">未确认</div>
                          <div v-if="scope.row.is_ok=='1'" size="mini" class="x-text-g">已完成</div>
                          <div v-if="scope.row.is_ok=='2'" size="mini" class="x-text-r">未完成</div>
                        </template>
                      </el-table-column>
                      <el-table-column label="追踪人" width="">
                        <template slot-scope="scope">
                          <div v-if="scope.row.username!=''||scope.row.username">{{scope.row.username}}</div>
                          <div v-else>无</div>
                        </template>
                      </el-table-column>
                      <el-table-column label="记录原因" width="">
                        <template slot-scope="scope">
                          <div v-if="scope.row.content==''&&scope.row.img==''">无</div>
                            <el-button type="text" size="mini" @click="editfavotwo(scope.row.cateid,scope.row.content,scope.row.img,scope.row.id)" v-else>查看</el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </template>
                </div>
              </template>
            </el-tab-pane>
            <el-tab-pane label="班组训练计划" name="third">
              <div class="x-inc-num">本月班组训练计划列表</div>
              <template>
                <el-table :data="tableDatayead">
                  <el-table-column label="训练班组" width="" fixed>
                    <template slot-scope="scope">
                      {{scope.row.dept_title}}
                    </template>
                  </el-table-column>
                  <el-table-column label="训练时间" width="">
                    <template slot-scope="scope">
                      {{scope.row.fin_date}}
                    </template>
                  </el-table-column>
                  <el-table-column label="指定人" width="">
                    <template slot-scope="scope">
                      {{scope.row.username}}
                    </template>
                  </el-table-column>
                  <el-table-column label="查看内容">
                    <template slot-scope="scope">
                      <el-button type="text" @click="editfavo(scope.row.dept_title,scope.row.content)">查看</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </el-tab-pane>
          </el-tabs>
        </template>
      </div>
      <!--  -->
      <el-dialog :title="toasttitle" :visible.sync="edittoast" width="90%" center="true" close-on-click-modal="false" show-close="false">
        <span>{{toastcon}}</span>
      </el-dialog>
      <!--  -->
      <el-dialog title="" :visible.sync="edittoasttwo" width="90%" center="true" close-on-click-modal="false" show-close="false">
        <div class="x-pro-row">
          <!-- <div class="x-pro-label">添加文字：</div> -->
          <div class="x-pro-input">
            <el-input placeholder="请输入" v-model="textvalue" type="textarea" :rows="3" disabled="true"></el-input>
          </div>
        </div>
        <div class="x-pro-himg" :style="{'background-image':'url(' +input4+ ')','background-size':'cover','width':'6rem','height':'6rem','border-radius':'0.4rem','margin-top':'1rem'}" v-if="input4!=''" @click="imagebig = true"></div>
      </el-dialog>
      <img :src="input4" alt="" width="100%" v-if="imagebig" class="x-img-big" @click="imagebig = false">
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {

  $api.fixStatusBar($api.byId('header'));


    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          cardsmonth:'',
          activeName: 'first',
          tableData:[],
          tableDatatwo:[],
          istype:'0',
          tableDatayead:[],
          itemKey:'',
          notkey:false,
          edittoast:false,
          toasttitle:'',
          toastcon:'',
          edittoasttwo:false,
          textvalue:'',
          input4:'',
          imagebig:false

        }
      },
      created:function() {
        var that=this;

      },
      mounted:function(){
        var that=this;
        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var day = date.getDate();
        if(month<10){
          month = '' + 0 + month;
        }
        if(day<10){
          day = '' + 0 + day;
        }
        var toMonth = '' + year + month + day;
        that.cardsmonth = toMonth;
        that.getdatafirst()

      },
      methods: {
        //记录要点
        editfavo:function(title,content){
          var that = this;
          that.toasttitle = title;
          that.toastcon = content;
          that.edittoast = true;
        },
        //记录要点2,3
        editfavotwo:function(id,con,img,clearid){
          var that = this;
          that.textvalue = con;
          that.input4 = img;
          that.editid = id;
          that.clearid = clearid;
          that.edittoasttwo = true;

        },
        //月份
        getmonth:function(val){
          var that = this;
          console.log(val);
          that.cardsmonth = val;
          if(that.istype=='0'){
            that.getdatafirst()
          }else if(that.istype=='1'){
            that.getdatatwo()
          }else if(that.istype=='2'){
            that.getdatathird()
          }

        },
        //选项卡
        handleClick(tab, event) {
          let id = event.target.getAttribute('id').split('-');
          let whitetab = id.join('').substring(3,9);
          let that = this;
          if(whitetab=='first'){//入职
            that.istype = '0';
            that.getdatafirst()
          }else if(whitetab=='second'){//离职
            that.istype = '1';
            that.getdatatwo()
          }else if(whitetab=='third'){//工龄
            that.istype = '2';
            that.getdatathird()
          }
        },
        //入职
        getdatafirst:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/teamcheck/getClear',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableData = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //离职
        getdatatwo:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/teamcheck/device',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableDatatwo = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //工龄
        getdatathird:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/meeting/weekTrainList2',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableDatayead = ret.data.list;
              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
      }
    })
	}


	</script>
</body>
</html>
